﻿/*
 * Created by SharpDevelop.
 * User: StrunevskyDV
 * Date: 05.04.2010
 * Time: 14:32
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.ComponentModel;

namespace FinancialPersonal.Base
{
	/// <summary>
	/// Description of DecimalTypeConverter.
	/// </summary>
	public class DecimalTypeConverter:DecimalConverter
	{
		string _firstCurr;
		string _secondCurr;
		decimal _ratio;
//		public DecimalTypeConverter(string firstCurr,string secondCurr,decimal ratio):base()
//		{
//			_ratio = ratio;
//			_firstCurr = firstCurr;
//			_secondCurr = secondCurr;
//		}
		
		public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
		{
			return base.ConvertFrom(context, culture, value);
		}
		
		public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
		{
			if(destinationType.Equals(typeof(string)))
			{
				string resul = ((Decimal)value).ToString("0,0.000$");
				//resul += ((Decimal)value*_ratio).ToString("0,0.000"+_secondCurr);
				return resul;
			}			                          
			return base.ConvertTo(context, culture, value, destinationType);
		}
		
	}
}
